package com.lxb;

import java.util.HashSet;
import java.util.Set;

public class LengthOfLongestSubstring {
    public static void main(String[] args) {

        String s = " ";
        int n = 0;
        int len = s.length()-1;

        Set<Character> set = new HashSet<Character>();
        for (int i = 0; i < len; i++) {
            if (i== 0){
                set.add(s.charAt(i));
                continue;
            }
            for (int j = i;j<len;j++){
                char c = s.charAt(j);
                if (!set.contains(s.charAt(j))){
                    set.add(s.charAt(j));
                }else{
                    n = Math.max(n,set.size());
                    set.clear();
                    break;
                }
            }
        }
        System.out.println(n);

    }
}
